<?php
	$tanggal   = $_GET["tanggal"];
	$tinggi    = $_GET["tinggi"];
	$motherID  = $_GET["motherID"];
	$pemeriksaan = $_GET["pemeriksaan"];
	
	$con = mysql_connect('localhost', 'root', '');
	if (!$con) die('Could not connect: ' . mysql_error());
	
	mysql_select_db("gestation", $con);	
	
	/* Search embrio ID */
	$result = mysql_query("SELECT * FROM embrio WHERE embrio_mother_id='$motherID'");
	while( $row = mysql_fetch_array($result) ){
		$embrioID = $row['embrio_id'];
	}

	/* Insert data pengukuran */
	$sql = "INSERT INTO measurement (measurement_embrio_id, measurement_height, measurement_date)
		VALUES ('$embrioID', '$tinggi','$tanggal')";
	$result = mysql_query($sql, $con);
	
	//echo "embrio id = ".$embrioID."<br>";
	echo "<tr> <td>".$pemeriksaan."</td>";
	echo "<td>".$tanggal."</td>";
	echo "<td>".$tinggi."</td> </tr>";

	mysql_close($con);
?>